(function (global) { ///blsurvey//// // Create IE + others compatible event handler var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; var eventer = window[eventMethod]; var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message"; eventer(messageEvent,function(e) { //console.log('parent received message!: ',e.data); if (e.data=="blCloseWindow") { blsurvey_window_close(); } else if (e.data=="blCloseWindowAnswered") { blsurvey_window_close_answered(); } },false); function blsurvey_window_close() { blsurvey_setc(pid,0); var surveyDiv = document.getElementById(surveyDivName); surveyDiv.innerHTML=''; surveyDiv.parentNode.removeChild(surveyDiv); } window.blsurvey_window_close = blsurvey_window_close; function blsurvey_window_close_answered() { blsurvey_setc(pid,1); var surveyDiv = document.getElementById(surveyDivName); surveyDiv.innerHTML=''; surveyDiv.parentNode.removeChild(surveyDiv); } window.blsurvey_window_close_answered = blsurvey_window_close_answered; function blsurvey_setc(p,a) { var now = new Date(); if (a) { now.setMonth( now.getMonth() + 6 ); } else { now.setHours(now.getHours() + 23); } var cookievalue = escape('avpres'); document.cookie="av_"+p+"=" + cookievalue+";path=/;expires=" + now.toUTCString() + ";" } function updateOrientation() { var orientation = window.orientation; if(orientation === 0 || orientation === 180) ori = 'portrait'; else if(orientation === 90 || orientation === -90) ori= 'landscape'; else { if(document.documentElement.clientWidth > document.documentElement.clientHeight) ori = 'landscape'; else ori = 'portrait'; } } function updateScreenSize() { if (isMeta) { //meta viewport tag exists viewportwidth = screen.width; viewportheight = screen.height; if(ori === 'portrait') { if(screen.width > screen.height) { viewportwidth = screen.height; viewportheight = screen.width; } } else { if(screen.width < screen.height){ viewportwidth = screen.height; viewportheight = screen.width; } } } else { //meta viewport tag does not exist viewportwidth = document.body.clientWidth; viewportheight = document.body.clientHeight; } } function schedUpd(nextUpd,i) { window.setTimeout(function(){ var script = document.getElementById('scallback_'+i); document.getElementsByTagName('head')[0].removeChild(script); ajax(global.avcast_url[i]+'&last_played='+global.last_sc_played[i],i); }, nextUpd); } function ajax(url,cb) { var script = document.createElement('script'); script.id='scallback_'+cb; script.src = url+'&callback='+cb; document.getElementsByTagName('head')[0].appendChild(script); } //load in bandlocal css////////////////// var styleTagvjs = document.createElement("link"); styleTagvjs.rel = "stylesheet"; styleTagvjs.type = "text/css"; styleTagvjs.media = "all"; styleTagvjs.href = "//www.siteminds.net/m/1.7/mind_local.css"; //"//files.hellonetcdn.com/st/js/gocast_combined_g16.css?s=3"; document.getElementsByTagName('head')[0].appendChild(styleTagvjs); ////////////////////////////////////////////////////// var isMeta = false; var metatag = document.querySelector("meta[name=viewport]"); if (metatag) { var tagconent = metatag.getAttribute("content") var ri = new RegExp('device-width', 'i'); isMeta = ri.test(tagconent); } // //am I mobile? Am I ie?//////////////// var mm_user_ag='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'; var mm_pmobile = false; var mm_isandroid = false; var mm_iphone = false; var is_ie = false; if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ) { mm_pmobile = true; mm_isandroid = true; } else if( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) ) { mm_pmobile = true; mm_iphone = true; } var trident = !!navigator.userAgent.match(/Trident\/7.0/); var net = !!navigator.userAgent.match(/.NET4.0E/); var IE11 = trident && net var IEold = ( navigator.userAgent.match(/MSIE/i) ? true : false ); if (IE11 || IEold) is_ie = true; /////////////////////////////////////////////////////////////// var docw=window.innerWidth; var doch=window.innerHeight; var surveyDivName; var viewportwidth; var viewportheight; var ori; //console.log('doch '+doch); var anyAutoPlayed = false; if(!global.avCast) { global.avCast = {}; }; var avCast = global.avCast; if(!avCast.allVideos) avCast.allVideos = []; //var allVideos = avCast.allVideos; if(!avCast.settings) avCast.settings = []; var settings = avCast.settings; if(!global.callBackObjs) global.callBackObjs = {}; if(!global.avck_callback) global.avck_callback = []; if(!global.avck_containers) global.avck_containers = []; if(!global.last_sc_played) global.last_sc_played = []; if(!global.avcast_url) global.avcast_url = []; for(var i = 0; i < settings.length; i++) { var cast = settings[i]; var pid = cast.pid; var dr = cast.dr; var ap = cast.autoplay; var avnum = cast.avnum; var avname = cast.avname; var band_type=cast.band_type; var left_side=cast.left; global.avck_containers[i] = cast.container; if (band_type=='av') { var w = Math.round(viewportwidth * 0.9); w = w > 725?725:w; var h = Math.round(viewportheight * 0.4); global.avcast_url[i]='//www.siteminds.net/m/1.7/mind_jsn_chk_av.php?band_type='+band_type+'&pid='+pid+'&dr='+dr+'&pm='+mm_pmobile+'&dw='+w+'&dh='+h+'&avname='+avname+'&avnum='+avnum+'&ap='+ap+'&left_side='+left_side; global.avck_callback[i] = function(e) { var i = e.castIndex; var cookievalue = ''; var cookieresults = document.cookie.match ( '(^|;) ?' + 'av_'+e.epid + '=([^;]*)(;|$)' ); if (cookieresults) cookievalue = unescape(cookieresults[2]); if ((cookievalue=='avpres') && (settings[0].autoplay!='2')) { e.should_play=false; //disabled for testing by forcing autoplay=2 in embed } if (e.should_play==true) { //console.log('mm_pmobile '+mm_pmobile); global.last_sc_played[i] = e.pid; global.avck_containers[i].innerHTML=e.divcontent; surveyDivName = 'survey-div'; if (left_side) { surveyDivName = 'survey-div_l'; } global.avck_containers[i].id=surveyDivName; if (mm_pmobile) { console.log('setting mobile class'); global.avck_containers[i].className='survey-div-m'; window.setTimeout(function(){ var iframe = document.getElementById('survey-frame').contentWindow; iframe.postMessage("adjustFontAndImage","*"); }, 500); } } }; //end of callback function } ajax(global.avcast_url[i],i); } })(this);